package models;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import play.db.ebean.Model;
import javax.persistence.*;
import play.db.ebean.*;
/**
 * User entity managed by Ebean
 */
@Entity
@Table(name="patient_history")
public class PatientHistory extends Model {

	public static final Long serialVersionUID = 1L;

	@Id
	@Column(name="idpatient_history")
	public Long id;

    @Column(name="age")
    public String age;

    @Column(name="gender")
    public String gender;

    @Column(name="weight")
    public Long weight;

    @Column(name="height")
    public Long height;

    @Column(name="marital_status")
    public String maritalStatus;

    @Column(name="smoking")
    public String smoking;

    @Column(name="drinking")
    public String drinking;

    @Column(name="bp")
    public String bp;

    @Column(name="heart")
    public String heart;

    @Column(name="cholestrol")
    public String cholestrol;

    @Column(name="diabetes")
    public String diabetes;

    @Column(name="kidney")
    public String kidney;

    @Column(name="asthma")
    public String asthma;

    @Column(name="tb")
    public String tb;

    @Column(name="liver")
    public String liver;

    @Column(name="arthritis")
    public String arthritis;

    @Column(name="bleeding")
    public String bleeding;

    @Column(name="cancer")
    public String cancer;

    @Column(name="hiv")
    public String hiv;
    
    @Column(name="food_allergy")
    public String foodAllergy;

    @Column(name="food_allergy_detail")
    public String foodAllergyDetail;

    @Column(name="drug_allergy")
    public String drugAllergy;

    @Column(name="drug_allergy_detail")
    public String drugAllergyDetail;

    @Column(name="chemical_allergy")
    public String chemicalAllergy;

    @Column(name="chemical_allergy_detail")
    public String chemicalAllergyDetail;

    @Column(name="pencillin_allergy")
    public String pencillinAllergy;

    @Column(name="pencillin_allergy_detail")
    public String pencillinAllergyDetail;

    @Column(name="medication")
    public String medication;

    @Column(name="medication_detail")
    public String medicationDetail;

    @OneToOne
    @JoinColumn(name="idPatient")
    //@Column(name="idPatient")
    public User patient;

    // -- Queries

    public static Model.Finder<String,PatientHistory> find = new Model.Finder(String.class, PatientHistory.class);

    public static PatientHistory getPatientHistory(Long patientId) {
        return find
        	.where()
        	.eq("idPatient", patientId)
            .findUnique();
    }
    
 

}

